import Router from "koa-router";
import Users from "./users.js";
import Ziyuan from "./ziyuan.js";

const router = new Router();

// 路由
router.get("/", (ctx, next) => {
    ctx.body = "routes/index.js --> get --> /";
});

router.get("/about", (ctx, next) => {
    ctx.body = "routes/index.js --> get --> /about";
});


// 嵌套路由 (路由级中间件)
router.use("/users", Users.routes(), Users.allowedMethods()); // 用户路由
router.use("/ziyuan", Ziyuan.routes(), Ziyuan.allowedMethods()); // 资源路由

export default router;
